<?php
/* -=-=-=-=-=-=-=-=-=-=-=-=-
     author by terry
-=-=-=-=-=-=-=-=-=-=-=-=- */
error_reporting(7);
require "global.php";
cpheader();
//set offset
if(!empty($_POST[offset]))
{$offset = $_POST[offset];}
else if  (!empty($_GET[offset]))
{$offset = $_GET[offset]; }
else  {$offset = 0; }

if ($_GET[action]=="add"||$_GET[action]=='mod'||$_GET[action]=='view'){

    $cpforms->inithtmlarea();
	if($_GET[action]=="view"){
		    $cpforms->formheader(array('title'=>'View Job (<font color=red>*</font>=Required Field)',
										'name'=>'article',
				                        'enctype'=>'multipart/form-data'));
		    $jobid = intval($_GET[id]);
			$cpforms->makehidden(array('name'=>'id','value'=>$jobid));
			$cpforms->makehidden(array('name'=>'offset','value'=>$offset));
            $view =1;
	        $rs  = $DB->fetch_one_array("SELECT * FROM ".$db_prefix."job WHERE jo_id =".$jobid);
	}

	
	?>
     <?       
		$cpforms->gethightext(array('text'=>"Create Date",'value'=>date("m/d/Y",$rs[jo_regtime]),'view'=>"1"));
		if($rs[jo_updtime]==0){$rs[jo_updtime] = $rs[jo_regtime];}
		$cpforms->gethightext(array('text'=>"Last Updated",'value'=>date("m/d/Y",$rs[jo_updtime]),'view'=>"1"));
		$cpforms->gethightext(array('text'=>"ER Job Req#",'value'=>$rs[jo_id],'view'=>"1"));
		
		$cpforms->longline(array('title'=>"Company Information"));
		$cpforms->gethightext(array('text'=>"Company Name",'name'=>"jo_copname",'only'=>1,'value'=>"$rs[jo_copname]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Company URL",'name'=>"jo_copurl",'value'=>"$rs[jo_copurl]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Contact Name",'name'=>"jo_priname",'value'=>"$rs[jo_priname]",'view'=>"$view",'icon'=>"'This information is for record keeping and internal use only.  It is not viewable by the public or recruiters.', WIDTH, 200, SHADOW, true"));
		$cpforms->gethightext(array('text'=>"Contact Email",'name'=>"jo_priemail",'value'=>"$rs[jo_priemail]",'view'=>"$view",'icon'=>"'This email address will receive all alerts of candidates submitted for this position.  It is not viewable by the public or recruiters.', WIDTH, 200, SHADOW, true"));
		$cpforms->gethightext(array('text'=>"Contact Phone",'name'=>"jo_priphone",'value'=>"$rs[jo_priphone]",'view'=>"$view",'icon'=>"'This information is for record keeping and internal use only.  It is not viewable by the public or recruiters.', WIDTH, 200, SHADOW, true"));
		$cpforms->maketextarea(array('text'=>"Company Culture",'name'=>"jo_copculture",'value'=>"$rs[jo_copculture]",'view'=>"$view",'icon'=>"'Describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
		$cpforms->maketextarea(array('text'=>"Company Benefits",'name'=>"jo_copbenefit",'value'=>"$rs[jo_copbenefit]",'view'=>"$view",'icon'=>"'Describe in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));


		$cpforms->longline(array('title'=>"Job Information"));
		$cpforms->getBoxes(array('text'=>"Contact Guideline",'only'=>1,'name'=>"jo_contact[]",'view'=>"$view",'selected'=>$rs[jo_contact],'option'=>$jobcontact));
		$cpforms->makeselect(array('text'=>"Job Type",'only'=>1,'name'=>"jo_type",'view'=>"$view",'selected'=>"$rs[jo_type]",'option'=>$jobtype));
		$cpforms->gethightext(array('text'=>"Job Valid By Date",'name'=>"jo_vdate",'only'=>1,'value'=>"$rs[jo_vdate]",'view'=>"$view"));
		$cpforms->makeselect(array('text'=>"Job Fill Status",'only'=>1,'name'=>"jo_status",'view'=>"$view",'selected'=>"$rs[jo_status]",'option'=> $jobfillstatus));
		$cpforms->makeselect(array('text'=>"Job Priority",'name'=>"jo_priority",'only'=>1,'selected'=>"$rs[jo_priority]",'view'=>"$view",'option'=> $priority));
		$cpforms->makeselect(array('text'=>"Job Category/Industry",'name'=>"jo_category",'only'=>1,'selected'=>"$rs[jo_category]",'view'=>"$view",'option'=> $jobcategory));
		$cpforms->makeselect(array('text'=>"Job Function",'name'=>"jo_function",'only'=>1,'selected'=>"$rs[jo_function]",'view'=>"$view",'option'=> $jobfunction));
		$cpforms->gethightext(array('text'=>"Job Title",'name'=>"jo_title",'only'=>1,'value'=>"$rs[jo_title]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Company Internal Req#",'name'=>"jo_copreq",'value'=>"$rs[jo_copreq]",'view'=>"$view",'icon'=>"'Enter an internal job code if available.', WIDTH, 200, SHADOW, true"));
		$cpforms->gethightext(array('text'=>"No. of Open Positions",'name'=>"jo_positions",'only'=>1,'value'=>"$rs[jo_positions]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Compensation(USD)",'name'=>"jo_salrange",'only'=>1,'value'=>"$rs[jo_salrange]",'view'=>"$view"));
//		$cpforms->makeselect(array('text'=>"Annual Base Salary Range(USD)",'name'=>"jo_salrange",'only'=>1,'selected'=>"$rs[jo_salrange]",'view'=>"$view",'option'=> $salary));
		//$cpforms->gethightext(array('text'=>"Placement Fee Estimate",'name'=>"jo_feerange",'value'=>"$rs[jo_feerange]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Work Address",'only'=>1,'name'=>"jo_address",'value'=>"$rs[jo_address]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Location - City",'name'=>"jo_city",'only'=>1,'value'=>"$rs[jo_city]",'view'=>"$view"));
		$cpforms->makeselect(array('text'=>"Location - State/Region",'name'=>"jo_state",'only'=>1,'selected'=>"$rs[jo_state]",'view'=>"$view",'option'=> $state));
		$cpforms->makeselect(array('text'=>"Location - Country",'name'=>"jo_country",'only'=>1,'selected'=>"$rs[jo_country]",'view'=>"$view",'option'=> $country));
		$cpforms->gethightext(array('text'=>"Location - Zip Code",'name'=>"jo_zip",'only'=>1,'value'=>"$rs[jo_zip]",'view'=>"$view"));
		$cpforms->makeselect(array('text'=>"Will consider candidates how far from company location?",'name'=>"jo_howfar",'only'=>1,'selected'=>"$rs[jo_howfar]",'view'=>"$view",'option'=> $location));
		$cpforms->makeselect(array('text'=>"Job Travel Requirement(%)",'only'=>1,'name'=>"jo_jobtravel",'selected'=>"$rs[jo_jobtravel]",'view'=>"$view",'option'=> $travel));
		$cpforms->maketextarea(array('text'=>"About the Hiring Manager",'name'=>"jo_hiringmanager",'value'=>"$rs[jo_hiringmanager]",'view'=>"$view",'icon'=>"'Please describe the hiring manager for this position in 250 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
		$cpforms->longline(array('title'=>"Job Qualifications"));

		$cpforms->gethightext(array('text'=>"Minimum Education Requirement",'name'=>"jo_mer",'only'=>1,'value'=>"$rs[jo_mer]",'view'=>"$view"));
		$cpforms->makeselect(array('text'=>"Minimum Years of Relevant Work Experience",'name'=>"jo_myrwe",'only'=>1,'selected'=>"$rs[jo_myrwe]",'view'=>"$view",'option'=> $yearexp2));
		$cpforms->makeselect(array('text'=>"Years of People Management Experience",'name'=>"jo_ypme",'only'=>1,'selected'=>"$rs[jo_ypme]",'view'=>"$view",'option'=> $yearexp2));
		$cpforms->makeselect(array('text'=>"Years of Profit & Loss Responsibility",'name'=>"jo_yplr",'only'=>1,'selected'=>"$rs[jo_yplr]",'view'=>"$view",'option'=> $yearexp2));
		$cpforms->gethightext(array('text'=>"Industry License Requirement",'name'=>"jo_license",'value'=>"$rs[jo_license]",'view'=>"$view"));

		$cpforms->gethightext(array('text'=>"Required Language Skills",'name'=>"jo_language",'value'=>"$rs[jo_language]",'view'=>"$view"));
		$cpforms->gethightext(array('text'=>"Authorized to Work in Location",'name'=>"jo_authorized",'only'=>1,'value'=>"$rs[jo_authorized]",'view'=>"$view",'icon'=>"'Please indicate the Country or Region where job candidates must have the authorization or permit to work.', WIDTH, 200, SHADOW, true"));
		$cpforms->gethighradio(array('text'=>"U.S. Government Security Clearance",'name'=>"jo_usgsc",'selected'=>"$rs[jo_usgsc]",'view'=>"$view",'icon'=>"'Indicate whether or not this job requires U.S. government clearance.', WIDTH, 200, SHADOW, true"));
		$cpforms->maketextarea(array('text'=>"Job Description (Cut and Paste or Type-in)",'name'=>"jo_description","only"=>1,'value'=>"$rs[jo_description]",'view'=>"$view",'icon'=>"'Please include all job details here in 3,000 characters or less.  You may edit this later.', WIDTH, 200, SHADOW, true"));
		$cpforms->maketextarea(array('text'=>"Public Note",'name'=>"jo_public",'value'=>"$rs[jo_public]",'view'=>"$view",'icon'=>"'Post a note about this job to Recruiters.', WIDTH, 200, SHADOW, true"));
		$cpforms->maketextarea(array('text'=>"Private Note",'name'=>"jo_private",'value'=>"$rs[jo_private]",'view'=>"$view",'icon'=>"'Post a note about this job to yourself.', WIDTH, 200, SHADOW, true"));	
		
		?>


<?
		
      if($_GET[action]=="view"){$cpforms->noformfooter();}
	   else{ $cpforms->formfooter(array('confirm'=>1));}
}


if ($_GET[action]=="list"||$_GET[action]=="search"){

	if($_GET[action]=="list"||$_GET[action]=="search"){ 
		if($_GET[copname]!='')                         { $arr[] = " `jo_copname`  like '%".$_GET[copname]."%'  ";$get[] = "copname=$_GET[copname]";}
		if($_GET[username]!='')                        { $arr[] = " `jo_username` like '%".$_GET[username]."%' ";$get[] = "username=$_GET[username]";}
		if($_GET[title]!='')                           { $arr[] = " `jo_title`    like '%".$_GET[title]."%'  "; $get[] = "title=$_GET[title]"; }
		if($_GET[city]!='')                            { $arr[] = " `jo_city`     like '%".$_GET[city]."%'  "; $get[] = "city=$_GET[city]";  }
		if($_GET[state]!='0'&&$_GET[state]!='')        { $arr[] = " `jo_state`    = '".$_GET[state]."'  ";  $get[] = "state=$_GET[state]";}
		if($_GET[country]!='0'&&$_GET[country]!='')    { $arr[] = " `jo_country`  = '".$_GET[country]."'  "; $get[] = "country=$_GET[country]";}
		if($_GET[industry]!='0'&&$_GET[industry]!='')  { $arr[] = " `jo_category`  = '".$_GET[industry]."'  ";$get[] = "industry=$_GET[industry]";}
		if($_GET['function']!='0'&&$_GET['function']!=''){ $arr[] = " `jo_function` = '".$_GET['function']."' ";$get[] = "function=$_GET[function]";}
		if($_GET[salary]!='')      { $arr[] = " `jo_salrange` = '".$_GET[salary]."'  ";$get[] = "salary=$_GET[salary]";}
		if($_GET[jobtype]!='0'&&$_GET[jobtype]!='')    { $arr[] = " `jo_type`     = '".$_GET[jobtype]."'  ";$get[] = "jobtype=$_GET[jobtype]";}
		if($_GET[postdate]!='')                        { $arr[] = " `jo_regtime`  like '%".$_GET[postdate]."%'  ";$get[] = "postdate=$_GET[postdate]";}
		if($_GET[jobtype]!='0'||$_GET[jobreq]!='')     { $arr[] = " `jo_id`       like '%".$_GET[jobreq]."%'  ";$get[] = "jobreq=$_GET[jobreq]";}
		$by = "jo_id"; 
		$order = "DESC";

		if(!empty($arr)){
			$implode  = @implode("AND", $arr);
		    $where    = "  WHERE ".$implode;
			if($_GET[orderby]!='0'){
			  $get[] = "orderby=$_GET[orderby]";
			  $a     = $_GET['orderby'];
			  $ord   = array('jo_copname','jo_username','jo_title','jo_city','jo_state','jo_country','jo_category','jo_function','jo_salrange','jo_type','jo_regtime','jo_id');
              switch($a){
			     case 1:
			       $_GET[swh]=1;
				 break;
				  case 2:
			       $_GET[swh]=2;
				 break;
				  case 3:
			       $_GET[swh]=8;
				 break;
				  case 4:
			       $_GET[swh]=10;
				 break;
				  case 5:
			       $_GET[swh]=11;
				 break;
				  case 6:
			       $_GET[swh]=12;
				 break;
				  case 7:
			       $_GET[swh]=5;
				 break;
				  case 8:
			       $_GET[swh]=7;
				 break;
				  case 9:
			       $_GET[swh]=9;
				 break;
				  case 10:
			       $_GET[swh]=4;
				 break;
				  case 11:
			       $_GET[swh]=13;
				 break;
				  case 12:
			       $_GET[swh]=3;
				 break;

			  }
		   }
		   $getarr   = @implode("&",$get); 
		}
		$nav = new buildNav;

		$total = $DB->fetch_one_array("SELECT COUNT(*) AS count FROM ".$db_prefix."job $where" );

		$nav->total_result = $total[count];

		if (empty($total[count])) {
			pa_exit("<font color=red>No job!</font><input type=button value='Add New' onclick='location.href=\"job.php?action=add\"'>");
		}


        $_GET[order1]==''&&$order1=1;$_GET[order2]==''&&$order2=1;$_GET[order3]==''&&$order3=1;$_GET[order4]==''&&$order4=1;
		$_GET[order5]==''&&$order5=1;$_GET[order6]==''&&$order6=1;$_GET[order7]==''&&$order7=1;$_GET[order8]==''&&$order8=1;
		switch($_GET[swh]){
		   case 1:
			   $by = "jo_copname";
               if($_GET[order1]==1){$order1=2; $order=" DESC ";$image1 = "<img src=\"images/dot1.gif\">";}else{$order1=1;$order=" ASC ";$image1 = "<img src=\"images/dot2.gif\">";}
			   break;
           case 2:
               $by = "jo_username";
               if($_GET[order2]==1){$order2=2; $order=" DESC ";$image2 = "<img src=\"images/dot1.gif\">";}else{$order2=1;$order=" ASC ";$image2 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 3:
                $by = "jo_id";
               if($_GET[order3]==1){$order3=2; $order=" DESC ";$image3 = "<img src=\"images/dot1.gif\">";}else{$order3=1;$order=" ASC ";$image3 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 4:
               $by = "jo_type";
               if($_GET[order4]==1){$order4=2; $order=" DESC ";$image4 = "<img src=\"images/dot1.gif\">";}else{$order4=1;$order=" ASC ";$image4 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 5:
               $by = "jo_category";
               if($_GET[order5]==1){$order5=2; $order=" DESC ";$image5 = "<img src=\"images/dot1.gif\">";}else{$order5=1;$order=" ASC ";$image5 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 6:
			   $by = "jo_status";
               if($_GET[order6]==1){$order6=2; $order=" DESC ";$image6 = "<img src=\"images/dot1.gif\">";}else{$order6=1;$order=" ASC ";$image6 = "<img src=\"images/dot2.gif\">";}
			   break;
           case 7:
               $by = "jo_function";
               if($_GET[order7]==1){$order7=2; $order=" DESC ";$image7 = "<img src=\"images/dot1.gif\">";}else{$order7=1;$order=" ASC ";$image7 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 8:
                $by = "jo_title";
               if($_GET[order8]==1){$order8=2; $order=" DESC ";$image8 = "<img src=\"images/dot1.gif\">";}else{$order8=1;$order=" ASC ";$image8 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 9:
               $by = "jo_salrange";
               if($_GET[order9]==1){$order9=2; $order=" DESC ";$image9 = "<img src=\"images/dot1.gif\">";}else{$order9=1;$order=" ASC ";$image9 = "<img src=\"images/dot2.gif\">";}
			   break;	
		   case 10:
                $by = "jo_city";
               if($_GET[order10]==1){$order10=2; $order=" DESC ";$image10 = "<img src=\"images/dot1.gif\">";}else{$order10=1;$order=" ASC ";$image10 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 11:
                $by = "jo_state";
               if($_GET[order11]==1){$order11=2; $order=" DESC ";$image11 = "<img src=\"images/dot1.gif\">";}else{$order11=1;$order=" ASC ";$image11 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 12:
                $by = "jo_country";
               if($_GET[order12]==1){$order12=2; $order=" DESC ";$image12 = "<img src=\"images/dot1.gif\">";}else{$order12=1;$order=" ASC ";$image12 = "<img src=\"images/dot2.gif\">";}
			   break;
		   case 13:
                $by = "jo_regtime";
               if($_GET[order13]==1){$order13=2; $order=" DESC ";$image13 = "<img src=\"images/dot1.gif\">";}else{$order13=1;$order=" ASC ";$image13 = "<img src=\"images/dot2.gif\">";}
			   break;
		}
	    $order = " ORDER BY $by $order";
		$sql   = "SELECT * FROM ".$db_prefix."job $where $order";
		//echo $sql;
		$nav->execute($sql);
    }
	
	echo $nav->title("Job list");
    $cpforms->inithtmlarea();

	//search
	$cpforms->formheader(array('title'=>'Search Job','name'=>'search','method'=>'GET'));
		   $cpforms->makehidden(array('name'=>'action','value'=>"search"));
		   $cpforms->gethightext(array('text'=>"Company Name",'name'=>"copname",'value'=>"$_GET[copname]"));
		   $cpforms->gethightext(array('text'=>"Job Title",'name'=>"title",'value'=>"$_GET[title]"));
		   $cpforms->gethightext(array('text'=>"City",'name'=>"city",'value'=>"$_GET[city]"));
		   $cpforms->makeselect(array('text'=>"State",'name'=>"state",'selected'=>"$_GET[state]",'viewfunction'=>'state','option'=>$state));
		   $cpforms->makeselect(array('text'=>"Country",'name'=>"country",'selected'=>"$_GET[country]",'viewfunction'=>'country','option'=>$country));
		   $cpforms->makeselect(array('text'=>"Industry",'name'=>"industry",'selected'=>"$_GET[industry]",'viewfunction'=>'jobcategory','option'=>$jobcategory));
		   $cpforms->makeselect(array('text'=>"Function",'name'=>"function",'selected'=>"$_GET[function]",'viewfunction'=>'jobfunction','option'=>$jobfunction));
		   $cpforms->makeselect(array('text'=>"Compensation(USD)",'name'=>"salary",'selected'=>"$_GET[salary]",'viewfunction'=>'salary','option'=>$salary));
	       $cpforms->makeselect(array('text'=>"Job Type",'view'=>"$view",'name'=>"jobtype",'selected'=>"$_GET[jobtype]",'viewfunction'=>'jobtype','option'=>$jobtype));
		   $cpforms->gethightext(array('text'=>"ER Job Req#",'name'=>'jobreq','value'=>"$_GET[jobreq]"));
		   $cpforms->makeselect(array('text'=>"Sort Results By",'name'=>"orderby",'selected'=>"$_GET[orderby]",'viewfunction'=>'orderby','option'=>$orderby));
	$cpforms->formfooter(array('confirm'=>1,'name'=>"search"));

    echo $nav->pagenav();
   

    echo "<table border=\"0\" width=\"100%\" cellpadding=\"4\" cellspacing=\"1\" class=\"tableoutline\">
	          <script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
               <tr align=\"center\" class=\"tbhead\">
                 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order1=$order1&swh=1&$getarr\">$image1 Company </a></td>
                 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order2=$order2&swh=2&$getarr\">$image2 User Name </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order3=$order3&swh=3&$getarr\">$image3 ER Job # </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order4=$order4&swh=4&$getarr\">$image4 Job Type </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order5=$order5&swh=5&$getarr\">$image5 Job Category </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order6=$order6&swh=6&$getarr\">$image6 Job Status </a></td>
                 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order7=$order7&swh=7&$getarr\">$image7 Job Function </a></td>
                 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order8=$order8&swh=8&$getarr\">$image8 Job Title </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order9=$order9&swh=9&$getarr\">$image9 Salary </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order10=$order10&swh=10&$getarr\">$image10 City </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order11=$order11&swh=11&$getarr\">$image11 State </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order12=$order12&swh=12&$getarr\">$image12 Country </a></td>
				 <td nowrap  width=\"10%\"><a href=\"job.php?action=list&offset=$_GET[offset]&order13=$order13&swh=13&$getarr\">$image13 Create Date </a></td>
				 <td nowrap  width=\"10%\"> Action </td>
               </tr>\n";
    while ($list = $DB->fetch_array($nav->sql_result)){
           echo "<tr class=".getrowbg().">
                      <td align=\"left\" nowrap>".$list[jo_copname]."</td>
					  <td align=\"left\">".$list[jo_username]."</td>
					  <td align=\"left\">".$list[jo_id]."</td>
					  <td align=\"left\">".$jobtype[$list[jo_type]]."</td>
					  <td align=\"left\">".$jobcategory[$list[jo_category]]."</td>
					  <td align=\"left\">".$jobfillstatus[$list[jo_status]]."</td>
					  <td align=\"left\">".$jobfunction[$list[jo_function]]."</td>
					  <td align=\"left\">".$list[jo_title]."</td>
					  <td align=\"left\">".$salary[$list[jo_salrange]]."</td>
					  <td align=\"left\">".$list[jo_city]."</td>
					  <td align=\"left\">".$state[$list[jo_state]]."</td>
					  <td align=\"left\">".$country[$list[jo_country]]."</td>
					  <td align=\"left\">".date('m/d/Y',$list[jo_regtime])."</td>
                      <td align=\"left\" nowrap><a href=\"job.php?action=view&offset=$_GET[offset]&id=$list[jo_id]\">View</a> | <a href=\"job.php?action=kill&offset=$_GET[offset]&id=$list[jo_id]\">Delete</a>";
    }
	if(empty($total[count])){
			echo "<tr><td><font color=red>No results!</font></td></tr>";
   }
    echo "</table>\n";
    echo $nav->pagenav();
}

if ($_GET[action]=="kill"){
    $cpforms->formheader(array('title'=>'Sure to delete this?'));
    $cpforms->makehidden(array('name'=>'action',
                                'value'=>'remove'));
    $cpforms->makehidden(array('name'=>'jobid',
                                'value'=>$_GET[id]));
	$cpforms->makehidden(array('name'=>'offset',
                                'value'=>$_GET[offset]));
    $cpforms->formfooter(array('confirm'=>2));
}


if( $_POST[action]=="remove"){
    $DB->query("DELETE FROM ".$db_prefix."job WHERE jo_id='$_POST[jobid]'");
    redirect("./job.php?action=list&offset=".$offset,"<font color=red>Deleted Successfully!</font>");
}



cpfooter();
?>